﻿#if USE_UNI_LUA
using LuaAPI = UniLua.Lua;
using RealStatePtr = UniLua.ILuaState;
using LuaCSFunction = UniLua.CSharpFunctionDelegate;
#else
using LuaAPI = XLua.LuaDLL.Lua;
using RealStatePtr = System.IntPtr;
using LuaCSFunction = XLuaBase.lua_CSFunction;
#endif

using XLua;
using System.Collections.Generic;


namespace XLua.CSObjectWrap
{
    using Utils = XLua.Utils;
    public class WebImageManagerWrap 
    {
        public static void __Register(RealStatePtr L)
        {
			ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
			System.Type type = typeof(WebImageManager);
			Utils.BeginObjectRegister(type, L, translator, 0, 4, 3, 3);
			
			Utils.RegisterFunc(L, Utils.METHOD_IDX, "UnLoadAllUnusedImage", _m_UnLoadAllUnusedImage);
			Utils.RegisterFunc(L, Utils.METHOD_IDX, "RemoveLoadWebImageHandler", _m_RemoveLoadWebImageHandler);
			Utils.RegisterFunc(L, Utils.METHOD_IDX, "AddLoadWebImageHandler", _m_AddLoadWebImageHandler);
			Utils.RegisterFunc(L, Utils.METHOD_IDX, "ReadFile", _m_ReadFile);
			
			
			Utils.RegisterFunc(L, Utils.GETTER_IDX, "CheckTime", _g_get_CheckTime);
            Utils.RegisterFunc(L, Utils.GETTER_IDX, "ImageHoldTime", _g_get_ImageHoldTime);
            Utils.RegisterFunc(L, Utils.GETTER_IDX, "MaxUnloadCount", _g_get_MaxUnloadCount);
            
			Utils.RegisterFunc(L, Utils.SETTER_IDX, "CheckTime", _s_set_CheckTime);
            Utils.RegisterFunc(L, Utils.SETTER_IDX, "ImageHoldTime", _s_set_ImageHoldTime);
            Utils.RegisterFunc(L, Utils.SETTER_IDX, "MaxUnloadCount", _s_set_MaxUnloadCount);
            
			
			Utils.EndObjectRegister(type, L, translator, null, null,
			    null, null, null);

		    Utils.BeginClassRegister(type, L, __CreateInstance, 4, 1, 0);
			Utils.RegisterFunc(L, Utils.CLS_IDX, "GetMD5HashFromString", _m_GetMD5HashFromString_xlua_st_);
            Utils.RegisterFunc(L, Utils.CLS_IDX, "IsFromWeb", _m_IsFromWeb_xlua_st_);
            Utils.RegisterFunc(L, Utils.CLS_IDX, "GetImagePrefixUrl", _m_GetImagePrefixUrl_xlua_st_);
            
			
            
			Utils.RegisterFunc(L, Utils.CLS_GETTER_IDX, "Instance", _g_get_Instance);
            
			
			
            Utils.RegisterFunc(L, Utils.CLS_IDX, "New", __CreateInstanceNew);
			Utils.EndClassRegister(type, L, translator);
        }
        
        [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
        static int __CreateInstance(RealStatePtr L)
        {
            
			try {
                ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
				if(LuaAPI.lua_gettop(L) == 1)
				{
					
					var gen_ret = new WebImageManager();
					translator.Push(L, gen_ret);
                    
					return 1;
				}
				
			}
			catch(System.Exception gen_e) {
				return LuaAPI.luaL_error(L, $"c# exception: {gen_e}\n{Yoozoo.Framework.Managers.LuaManager.GetTraceBack()}");
			}
            return LuaAPI.luaL_error(L, "invalid arguments to WebImageManager constructor!");
            
        }

        [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
        static int __CreateInstanceNew(RealStatePtr L)
        {
            
			try {
                ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
				if(LuaAPI.lua_gettop(L) == 0)
				{
					
					var gen_ret = new WebImageManager();
					translator.Push(L, gen_ret);
                    
					return 1;
				}
				
			}
			catch(System.Exception gen_e) {
				return LuaAPI.luaL_error(L, $"c# exception: {gen_e}\n{Yoozoo.Framework.Managers.LuaManager.GetTraceBack()}");
			}
            return LuaAPI.luaL_error(L, "invalid arguments to WebImageManager constructor!");
            
        }

        
		
        
		
        
        
        
        
        [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
        static int _m_UnLoadAllUnusedImage(RealStatePtr L)
        {
		    try {
            
                ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
            
            
                WebImageManager gen_to_be_invoked = (WebImageManager)translator.FastGetCSObj(L, 1);
            
            
                
                {
                    
                    gen_to_be_invoked.UnLoadAllUnusedImage(  );
                    
                    
                    
                    return 0;
                }
                
            } catch(System.Exception gen_e) {
                return LuaAPI.luaL_error(L, $"c# exception: {gen_e}\n{Yoozoo.Framework.Managers.LuaManager.GetTraceBack()}");
            }
            
        }
        
        [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
        static int _m_RemoveLoadWebImageHandler(RealStatePtr L)
        {
		    try {
            
                ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
            
            
                WebImageManager gen_to_be_invoked = (WebImageManager)translator.FastGetCSObj(L, 1);
            
            
                
                {
                    object _obj = translator.GetObject(L, 2, typeof(object));
                    string _imageUrl = LuaAPI.lua_tostring(L, 3);
                    Yoozoo.Framework.Manager.ResourceSystem.Runtime.WebImageHandler _webImageHandler = (Yoozoo.Framework.Manager.ResourceSystem.Runtime.WebImageHandler)translator.GetObject(L, 4, typeof(Yoozoo.Framework.Manager.ResourceSystem.Runtime.WebImageHandler));
                    
                    gen_to_be_invoked.RemoveLoadWebImageHandler( _obj, _imageUrl, _webImageHandler );
                    
                    
                    
                    return 0;
                }
                
            } catch(System.Exception gen_e) {
                return LuaAPI.luaL_error(L, $"c# exception: {gen_e}\n{Yoozoo.Framework.Managers.LuaManager.GetTraceBack()}");
            }
            
        }
        
        [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
        static int _m_AddLoadWebImageHandler(RealStatePtr L)
        {
		    try {
            
                ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
            
            
                WebImageManager gen_to_be_invoked = (WebImageManager)translator.FastGetCSObj(L, 1);
            
            
                
                {
                    object _obj = translator.GetObject(L, 2, typeof(object));
                    string _imageUrl = LuaAPI.lua_tostring(L, 3);
                    Yoozoo.Framework.Manager.ResourceSystem.Runtime.WebImageHandler _webImageHandler = (Yoozoo.Framework.Manager.ResourceSystem.Runtime.WebImageHandler)translator.GetObject(L, 4, typeof(Yoozoo.Framework.Manager.ResourceSystem.Runtime.WebImageHandler));
                    
                    gen_to_be_invoked.AddLoadWebImageHandler( _obj, _imageUrl, _webImageHandler );
                    
                    
                    
                    return 0;
                }
                
            } catch(System.Exception gen_e) {
                return LuaAPI.luaL_error(L, $"c# exception: {gen_e}\n{Yoozoo.Framework.Managers.LuaManager.GetTraceBack()}");
            }
            
        }
        
        [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
        static int _m_ReadFile(RealStatePtr L)
        {
		    try {
            
                ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
            
            
                WebImageManager gen_to_be_invoked = (WebImageManager)translator.FastGetCSObj(L, 1);
            
            
                
                {
                    string _filePath = LuaAPI.lua_tostring(L, 2);
                    
                        var gen_ret = gen_to_be_invoked.ReadFile( _filePath );
                        LuaAPI.lua_pushstring(L, gen_ret);
                    
                    
                    
                    return 1;
                }
                
            } catch(System.Exception gen_e) {
                return LuaAPI.luaL_error(L, $"c# exception: {gen_e}\n{Yoozoo.Framework.Managers.LuaManager.GetTraceBack()}");
            }
            
        }
        
        [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
        static int _m_GetMD5HashFromString_xlua_st_(RealStatePtr L)
        {
		    try {
            
            
            
			    int gen_param_count = LuaAPI.lua_gettop(L);
            
                if(gen_param_count == 2&& (LuaAPI.lua_isnil(L, 1) || LuaAPI.lua_type(L, 1) == LuaTypes.LUA_TSTRING)&& LuaTypes.LUA_TBOOLEAN == LuaAPI.lua_type(L, 2)) 
                {
                    string _str = LuaAPI.lua_tostring(L, 1);
                    bool _large = LuaAPI.lua_toboolean(L, 2);
                    
                        var gen_ret = WebImageManager.GetMD5HashFromString( _str, _large );
                        LuaAPI.lua_pushstring(L, gen_ret);
                    
                    
                    
                    return 1;
                }
                if(gen_param_count == 1&& (LuaAPI.lua_isnil(L, 1) || LuaAPI.lua_type(L, 1) == LuaTypes.LUA_TSTRING)) 
                {
                    string _str = LuaAPI.lua_tostring(L, 1);
                    
                        var gen_ret = WebImageManager.GetMD5HashFromString( _str );
                        LuaAPI.lua_pushstring(L, gen_ret);
                    
                    
                    
                    return 1;
                }
                
            } catch(System.Exception gen_e) {
                return LuaAPI.luaL_error(L, $"c# exception: {gen_e}\n{Yoozoo.Framework.Managers.LuaManager.GetTraceBack()}");
            }
            
            return LuaAPI.luaL_error(L, "invalid arguments to WebImageManager.GetMD5HashFromString!");
            
        }
        
        [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
        static int _m_IsFromWeb_xlua_st_(RealStatePtr L)
        {
		    try {
            
            
            
                
                {
                    string _value = LuaAPI.lua_tostring(L, 1);
                    
                        var gen_ret = WebImageManager.IsFromWeb( _value );
                        LuaAPI.lua_pushboolean(L, gen_ret);
                    
                    
                    
                    return 1;
                }
                
            } catch(System.Exception gen_e) {
                return LuaAPI.luaL_error(L, $"c# exception: {gen_e}\n{Yoozoo.Framework.Managers.LuaManager.GetTraceBack()}");
            }
            
        }
        
        [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
        static int _m_GetImagePrefixUrl_xlua_st_(RealStatePtr L)
        {
		    try {
            
            
            
                
                {
                    int _addressIndex = LuaAPI.xlua_tointeger(L, 1);
                    
                        var gen_ret = WebImageManager.GetImagePrefixUrl( _addressIndex );
                        LuaAPI.lua_pushstring(L, gen_ret);
                    
                    
                    
                    return 1;
                }
                
            } catch(System.Exception gen_e) {
                return LuaAPI.luaL_error(L, $"c# exception: {gen_e}\n{Yoozoo.Framework.Managers.LuaManager.GetTraceBack()}");
            }
            
        }
        
        
        
        
        [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
        static int _g_get_Instance(RealStatePtr L)
        {
		    try {
                ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
			    translator.Push(L, WebImageManager.Instance);
            } catch(System.Exception gen_e) {
                return LuaAPI.luaL_error(L, $"c# exception: {gen_e}\n{Yoozoo.Framework.Managers.LuaManager.GetTraceBack()}");
            }
            return 1;
        }
        
        [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
        static int _g_get_CheckTime(RealStatePtr L)
        {
		    try {
                ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
			
                WebImageManager gen_to_be_invoked = (WebImageManager)translator.FastGetCSObj(L, 1);
                LuaAPI.lua_pushnumber(L, gen_to_be_invoked.CheckTime);
            } catch(System.Exception gen_e) {
                return LuaAPI.luaL_error(L, $"c# exception: {gen_e}\n{Yoozoo.Framework.Managers.LuaManager.GetTraceBack()}");
            }
            return 1;
        }
        
        [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
        static int _g_get_ImageHoldTime(RealStatePtr L)
        {
		    try {
                ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
			
                WebImageManager gen_to_be_invoked = (WebImageManager)translator.FastGetCSObj(L, 1);
                LuaAPI.lua_pushnumber(L, gen_to_be_invoked.ImageHoldTime);
            } catch(System.Exception gen_e) {
                return LuaAPI.luaL_error(L, $"c# exception: {gen_e}\n{Yoozoo.Framework.Managers.LuaManager.GetTraceBack()}");
            }
            return 1;
        }
        
        [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
        static int _g_get_MaxUnloadCount(RealStatePtr L)
        {
		    try {
                ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
			
                WebImageManager gen_to_be_invoked = (WebImageManager)translator.FastGetCSObj(L, 1);
                LuaAPI.xlua_pushinteger(L, gen_to_be_invoked.MaxUnloadCount);
            } catch(System.Exception gen_e) {
                return LuaAPI.luaL_error(L, $"c# exception: {gen_e}\n{Yoozoo.Framework.Managers.LuaManager.GetTraceBack()}");
            }
            return 1;
        }
        
        
        
        [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
        static int _s_set_CheckTime(RealStatePtr L)
        {
		    try {
                ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
			
                WebImageManager gen_to_be_invoked = (WebImageManager)translator.FastGetCSObj(L, 1);
                gen_to_be_invoked.CheckTime = (float)LuaAPI.lua_tonumber(L, 2);
            
            } catch(System.Exception gen_e) {
                return LuaAPI.luaL_error(L, $"c# exception: {gen_e}\n{Yoozoo.Framework.Managers.LuaManager.GetTraceBack()}");
            }
            return 0;
        }
        
        [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
        static int _s_set_ImageHoldTime(RealStatePtr L)
        {
		    try {
                ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
			
                WebImageManager gen_to_be_invoked = (WebImageManager)translator.FastGetCSObj(L, 1);
                gen_to_be_invoked.ImageHoldTime = (float)LuaAPI.lua_tonumber(L, 2);
            
            } catch(System.Exception gen_e) {
                return LuaAPI.luaL_error(L, $"c# exception: {gen_e}\n{Yoozoo.Framework.Managers.LuaManager.GetTraceBack()}");
            }
            return 0;
        }
        
        [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
        static int _s_set_MaxUnloadCount(RealStatePtr L)
        {
		    try {
                ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
			
                WebImageManager gen_to_be_invoked = (WebImageManager)translator.FastGetCSObj(L, 1);
                gen_to_be_invoked.MaxUnloadCount = LuaAPI.xlua_tointeger(L, 2);
            
            } catch(System.Exception gen_e) {
                return LuaAPI.luaL_error(L, $"c# exception: {gen_e}\n{Yoozoo.Framework.Managers.LuaManager.GetTraceBack()}");
            }
            return 0;
        }
        
		
		
		
		
    }
}
